<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<meta name="format-detection" content="telephone=no,email=no" />
		<title>退单列表</title>
		<link href="css/mui.min.css" rel="stylesheet" />
		<link href="css/style.css" rel="stylesheet" />
	</head>
	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">退单列表</h1>
		</header>
		
		<div id="pullrefresh" class="mui-content mui-scroll-wrapper transparent">
			<div class="mui-scroll">
				<div id="orderList">
				</div>
			</div>
		</div>
		<div id="dcontent" class="dcontent"></div>
		<script src="js/mui.min.js"></script>
		<!--<script src="js/delayimg.min.js"></script>-->
		<script src="js/app.js"></script>
		<script>
			var isnodata = false,
				page = 1,
				title=document.getElementsByClassName('mui-title')[0],
				loadPage;
			mui.init({
				beforeback:function(){
					mui.fire(plus.webview.getWebviewById('user/usercenter.html'),'updateData');
				},
				pullRefresh : {
				    container:'#pullrefresh',
				    deceleration:0.0006,
				     down : {
						contentdown : "下拉可以刷新",
						contentover : "释放立即刷新",
						contentrefresh : "正在刷新...",
						callback :function(){
							setTimeout(function(){
								page=1;
								loadPage(page,function(){
									mui('#pullrefresh').pullRefresh().endPulldownToRefresh();
								});
								
							},2000)
							
							
						}
				    },
				    up : {
					    contentrefresh : "正在加载...",
					    contentnomore:'已加载完订单',
					    callback :function(){
					    		var self=this;
					    		if (!isnodata) {
				    				page++;
						      	/*---------*/
					      		mui.ajax(URL+'api/MemberOrder/GetOrderRefundList?applyDate=all&auditStatus=0&pageNo='+page+'&pageSize=10&showtype=0',{
								dataType:'json',
								type:'get',
								timeout:10000,
					      		success:function(data){
										
										var html='';
										if(data.Success){
											if(data.date.length > 0) {
										        	for(var i=0;i<data.date.length;i++){
										            html+='<div class="order-info">'+
														'<div class="item">'+
															'<div class="order-shop">'+
															'<a class="vshop-url">'+data.date[i].ShopName+'</a>'+
															'<span class="mui-pull-right">'+data.date[i].RefundStatus+'</span></div>'+
														'</div>';
										          
										                html+='<div class="item productlist">'+
										                    '<div class="buy-goods clearfix">'+
			
										                        '<p><em>¥ '+data.date[i].OrderId+'</em><span><a class="goods-url" >'+data.date[i].OrderId+'</a></span></p>'+
			
										                    '</div>'+
											                '</div>';
										               	 
											        html+='</div>';
		
										       	}
										        	 	document.getElementById('orderList').insertAdjacentHTML('beforeend',html);
											}else{
												 		isnodata = true;
											}
												self.endPullupToRefresh(isnodata);
										}
					      			},
					      		error:function(data){
					      				plus.nativeUI.toast('请求失败，请检查网络')
					      			}
					      		})
								
								
								/*---------*/
							}else{
								self.endPullupToRefresh(isnodata);
							}
				    		}
				    }
				},
				swipeBack: true
			});
			
			if (mui.os.android)
				document.getElementsByClassName('mui-scroll')[0].className='';
			
			mui.plusReady(function() {

				plus.webview.currentWebview().setStyle({scrollIndicator:'none'});
				var w=plus.nativeUI.showWaiting('',{padlock:true});
				loadPage=function(_page,_callback){
					mui.ajax(URL+'api/MemberOrder/GetOrderRefundList?applyDate=all&auditStatus=0&pageNo='+_page+'&pageSize=10&showtype=0',{
						dataType:'json',
						type:'get',
						timeout:10000,
						success:function(data){

//							console.log(JSON.stringify(data))
								var html='';
							if(data.Success){
								if(data.date.length > 0) {
							        	for(var i=0;i<data.date.length;i++){
							            html+='<div class="order-info">'+
											'<div class="item">'+
												'<div class="order-shop">'+
												'<a class="vshop-url">'+data.date[i].ShopName+'</a>'+
												'<span class="mui-pull-right">'+data.date[i].RefundStatus+'</span></div>'+
											'</div>';
							          
							                html+='<div class="item productlist">'+
							                    '<div class="buy-goods clearfix">'+

							                        '<p><em>'+data.date[i].OrderId+'</em><span><a class="goods-url" >'+data.date[i].OrderId+'</a></span></p>'+

							                    '</div>'+
								                '</div>';
							               	 
								        html+='</div>';
								        
							       	}
							        	document.getElementById('orderList').innerHTML=html;
							       
								}else{
									 	html+='<div class="empty-show"><h4>暂无此类订单...</h4><button id="closeWv" class="mui-btn mui-btn-negative">去其他地方逛逛</button></div>';
							        		document.getElementById('pullrefresh').innerHTML=html;
								}
								w.close();
								document.getElementById('pullrefresh').className='mui-content mui-scroll-wrapper';
								
								if(_callback){
									_callback()
								}
								
							}
						},
						error:function(xhr,type,errorThrown){
//							console.log(JSON.stringify(xhr))

								if(_callback){
									_callback()
								}
							w.close();
							reloadWvLoad();
						}
					});
				}

				loadPage(page);

			});

			
		</script>
	</body>

</html>